﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace _3D_Game
{
    class SpinningEnemy : BasicModel
    {
        Matrix rotation = Matrix.Identity;
        float yawAngle = 0;
        float pitchAngle = 0;
        float rollAngle = 0;
        Vector3 direction;

        public SpinningEnemy(Model model, Vector3 position, Vector3 direction, float yaw, float pitch, float roll)
            : base(model)
        {
            world = Matrix.CreateTranslation(position);
            this.yawAngle = yaw;
            this.pitchAngle = pitch;
            this.rollAngle = roll;
            this.direction = direction;
        }

        public override void Update()
        {
            rotation *= Matrix.CreateFromYawPitchRoll(yawAngle, pitchAngle, rollAngle);

            world *= Matrix.CreateTranslation(direction);
        }

        public override Matrix GetWorld()
        {
            return rotation * world;
        }
    }
}
